﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace CPPEI.Coolzon.Designer.Views
{
    public static class DesignUIUtil
    {
        /// <summary>
        /// partframe里的坐标点位置换算为canvas上的坐标点位置
        /// </summary>
        /// <param name="pointInFrame"></param>
        /// <param name="partFrame"></param>
        /// <param name="designCanvas"></param>
        /// <returns></returns>
        public static Point PointInFrameToCanvas(Point pointInFrame, Coolzon.UI.PartFrame partFrame, Canvas designCanvas)
        {
            return partFrame.TranslatePoint(pointInFrame, designCanvas);
        }

        /// <summary>
        /// 将canvas里的坐标点转换为partframe上的坐标点
        /// </summary>
        /// <param name="pointInCanvas"></param>
        /// <param name="designCanvas"></param>
        /// <param name="partFrame"></param>
        /// <returns></returns>
        public static Point PointInCanvasToPartFrame(Point pointInCanvas, Canvas designCanvas, Coolzon.UI.PartFrame partFrame)
        {
            return designCanvas.TranslatePoint(pointInCanvas, partFrame);
        }

        #region point canvas - partcontainer
        public static Point PointInPartContainerToCanvas(Point pointInPart, Coolzon.UI.IPartContainer partContainer, Canvas designCanvas)
        {
            return partContainer.GetContentContainer().TranslatePoint(pointInPart, designCanvas);
        }

        public static Point PointInCanvasToPartContainer(Point pointInCanvas, Canvas designCanvas, Coolzon.UI.IPartContainer partContainer)
        {
            return designCanvas.TranslatePoint(pointInCanvas, partContainer.GetContentContainer());
        }
        #endregion


    }
}
